#ifndef NETWORK_ERROR_HANDLER_HH
# define NETWORK_ERROR_HANDLER_HH

# include "../request/request.hh"

class NetworkErrorHandler
{
public:
  NetworkErrorHandler ():
    error_ (false)
  {
  }

  //read errors
  virtual boost::shared_ptr<Request> readFail (const std::exception& e) = 0;
  virtual boost::shared_ptr<Request> readWrongSize (int numread, int toread) = 0;
  virtual std::string rawReadFail (const std::exception& e) = 0;

  //write errors
  virtual void sendFail (const std::exception& e) = 0;

  bool error () const { return error_; }
  void error (bool val) { error_ = val; }

protected:
  bool error_;
};

#endif /// !NETWORK_ERROR_HANDLER_HH
